<span class="latest_title">Kết quả tìm kiếm <span style="text-transform: lowercase;"></span></span>
<div class="content">
        <?php
        foreach($movieArray as $movie):
            //url like <base url>movie/view/id/name-of-movie.html
        ?>
        <div class="search_js">
            <div class="left-sjs">
                <a href="<?php echo base_url() . 'video/view/' . $movie['movie_id'] . '/' . convertUri($movie['movie_name']) . '.html'; ?>">
                    <img style="border: none;" class="play-img" title="<?php echo $movie['movie_name'];?>" src="<?php echo base_url();?>images/play2.png"/>
                    <img style="border: 1px solid #777;" src="<?php echo base_url() .$movie['movie_image']; ?>" title="<?php echo $movie['movie_name'];?>"/>
                </a>
            </div>
            <div class="right-sjs">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td class="vinfo_title">
                            <a href="<?php echo base_url() . 'video/view/' . $movie['movie_id'] . '/' . convertUri($movie['movie_name']) . '.html'; ?>">
                            <?php echo $movie['movie_name']; ?>
                            </a>
                        </td>
                    </tr>
                     <tr>
                        <td>
                            <ul class='star-rating' id='star-rating'>
                                <div id='mystar-rating'>
                                    <?php
                                        $rating = $movie['movie_rating'] * 15;
                                    ?>
                                    <li class="current-rating" style="width:<?php echo $rating; ?>px"></li>
                                </div>
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td class="vinfo_col2">
                            Lượt xem: <?php echo $movie['movie_views']; ?>
                        </td>
                    </tr>
                     <tr>
                        <td class="vinfo_col2">
                            Sản xuất: <?php echo $movie['movie_views']; ?>
                        </td>
                    </tr>
                    <tr>
                        <td class="vinfo_col2">
                            Diễn viên: <?php echo $movie['movie_actors']; ?>
                        </td>
                    </tr>
                    <tr>
                        <td class="vinfo_col2">
                            Nội dung: <?php echo $movie['movie_main_content']; ?>
                        </td>
                    </tr>
                </table>
            </div>
            <span class="hr"><img src="<?php echo base_url(); ?>images/hr.gif" alt=""></span>
        </div>
        <?php
        endforeach;
        ?>
    <div class="paging">
        <div class="loading"></div>
        <div class="pagination">
        <?php
        if(isset($flag) && $flag == 'category' && count($pageArr) > 0){ //search by cat
            $temp = '';
            //first page
            if($currPage != 1){
                $prePage = $currPage - 1;
                echo "<span onclick=\"searchCategory($catID, 1);\"> << </span>";
                echo "<span onclick=\"searchCategory($catID, $prePage);\"> < </span>";
            }
            for($i = 0; $i < count($pageArr); $i++):
            if($pageArr[$i] != $currPage)
                $temp .= "<span onclick=\"searchCategory($catID, $pageArr[$i]);\">".$pageArr[$i]."</span>";
            else
                $temp .= "<span class='active'>".$pageArr[$i]."</span> ";

            endfor;
            echo $temp;
            //last page
            if($currPage != $endPage){
                $nextPage = $currPage + 1;
                echo "<span onclick=\"searchCategory($catID, $nextPage);\"> > </span>";
                echo "<span onclick=\"searchCategory($catID, $endPage);\"> >> </span>";
            }

        }
        elseif(isset($flag) && $flag == 'actor' && count($pageArr) > 0){ //search by actor
            $temp = '';
            //first page
            if($currPage != 1){
                $prePage = $currPage - 1;
                echo "<span onclick=\"searchActor($catID, '$value',1);\"> << </span>";
                echo "<span onclick=\"searchActor($catID, '$value',$prePage);\"> < </span>";
            }
            for($i = 0; $i < count($pageArr); $i++):
            if($pageArr[$i] != $currPage)
                $temp .= "<span onclick=\"searchActor($catID, '$value',$pageArr[$i]);\">$pageArr[$i]</span>";
            else
                $temp .= "<span class='active'>$pageArr[$i]</span> ";

            endfor;
            echo $temp;
            //last page
            if($currPage != $endPage){
                $nextPage = $currPage + 1;
                echo "<span onclick=\"searchActor($catID, '$value',$nextPage);\"> > </span>";
                echo "<span onclick=\"searchActor($catID, '$value',$endPage);\"> >> </span>";
            }

        }
        else{ //search by video name
            if(count($pageArr) > 0):
                $temp = '';
                //first page
                if($currPage != 1){
                    $prePage = $currPage - 1;
                    echo "<span onclick=\"search2('$value',1);\"> << </span>";
                    echo "<span onclick=\"search2('$value',$prePage);\"> < </span>";
                }
                for($i = 0; $i < count($pageArr); $i++):
                if($pageArr[$i] != $currPage)
                    $temp .= "<span onclick=\"search2('$value', $pageArr[$i]);\">$pageArr[$i]</span>";
                else
                    $temp .= "<span class='active'>$pageArr[$i]</span> ";

                endfor;
                echo $temp;
                //last page
                if($currPage != $endPage){
                    $nextPage = $currPage + 1;
                    echo "<span onclick=\"search2('$value',$nextPage);\"> > </span>";
                    echo "<span onclick=\"search2('$value',$endPage);\"> >> </span>";
                }
            endif;
        }
        ?>
        </div>
    </div>
</div>
 
